package com.yzyz.utils.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import org.springframework.jdbc.core.RowMapper;

import com.yzyz.bean.news.NewsBean;

public class NewsRowMapper implements RowMapper {

	@Override
	public Object mapRow(ResultSet rs, int arg1) throws SQLException {
		NewsBean news = new NewsBean();
		news.setId(rs.getInt("id"));
		news.setContents(rs.getString("contents"));
		news.setDate(new Date(rs.getTimestamp("date").getTime()));
		news.setName(rs.getString("name"));
		news.setLevel(rs.getInt("level"));
		return news;
	}

}
